Skip to content

Implement bot reports and enhance user response fields#13

Merged
ValDesign22 merged 22 commits intofeat/integrationsfrom
feat/reports
Apr 3, 2026
Merged

Implement bot reports and enhance user response fields#13
ValDesign22 merged 22 commits intofeat/integrationsfrom
feat/reports

Conversation

@ValDesign22
Copy link
Copy Markdown
Member

This pull request introduces a new reports feature for bots (behind a feature flag), refactors bot access control logic to use model methods instead of service calls, and simplifies session and event management. The most significant changes are the addition of the reports API endpoints, improved access checks, and cleanup of unnecessary dependencies in route handlers.

New Reports Feature:

  • Added a new reports module under src/api/routes/bots/bot/ (gated by the reports feature flag), providing endpoints to subscribe, unsubscribe, and list report subscriptions for a bot. The endpoints enforce proper authorization and handle duplicate or missing subscriptions. (src/api/routes/bots/bot/reports/mod.rs, src/api/routes/bots/bot/mod.rs) [1] [2] [3]

Access Control Refactor:

  • Replaced calls to services.auth.user_has_bot_access and services.auth.user_owns_bot with direct bot.has_access and bot.is_owner method calls in all relevant bot, achievements, and event route handlers, improving readability and encapsulation. (src/api/routes/bots/bot/mod.rs, src/api/routes/bots/bot/achievements/mod.rs, src/api/routes/bots/bot/events/mod.rs, src/api/routes/bots/bot/events/event/mod.rs) [1] [2] [3] [4] [5] [6] [7] [8]

  • Removed unnecessary Services dependencies from route handler signatures and imports, further simplifying the code. (src/api/routes/bots/bot/mod.rs, src/api/routes/bots/bot/achievements/mod.rs, src/api/routes/bots/bot/events/mod.rs, src/api/routes/bots/bot/events/event/mod.rs) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Session and Event Management Improvements:

  • In the sessions API, improved the logic for marking the current session and refactored session revocation to use a new revoke_many_for_user repository method for efficiency. (src/api/routes/auth/sessions/mod.rs) [1] [2] [3]

  • Cleaned up redundant code in the bot deletion handler by removing a duplicate existence check. (src/api/routes/bots/bot/mod.rs)

These changes collectively improve maintainability, security, and extensibility of the bot API.

@ValDesign22 ValDesign22 self-assigned this Mar 28, 2026
@ValDesign22 ValDesign22 added the enhancement New feature or request label Mar 28, 2026
Comment thread src/api/routes/bots/bot/reports/mod.rs Outdated
Comment thread src/api/routes/bots/bot/reports/mod.rs Outdated
Comment thread src/tasks/reports.rs Outdated
@ValDesign22 ValDesign22 merged commit 743273e into feat/integrations Apr 3, 2026
5 checks passed
@ValDesign22 ValDesign22 deleted the feat/reports branch April 3, 2026 12:43
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants